<template>
  <el-sub-menu v-if="data.children && data.children.length"
    :index="data.path"
  >
    <template #title>{{data.label}}</template>
    <MenuItem
      v-for="item in data.children"
      :key="item.path"
      :data="item"
    />
  </el-sub-menu>
  <el-menu-item v-else
    :index="data.path"
  >{{data.label}}</el-menu-item>
</template>

<script>
import MenuItem from './menuItem.vue'
export default {
  components: {
    MenuItem
  },
  props: {
    data: {
      type: Object,
      default: () => ({})
    }
  },
  setup () {}
}
</script>

<style lang="less" scoped>
</style>
